package pers.li.controller.order;

import pers.li.model.VO.OrderVO;
import pers.li.service.OrderService;
import pers.li.utils.PublicUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/order/myOrders.action")
public class MyOrders extends HttpServlet {
    private final OrderService orderService = new OrderService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer userId = PublicUtils.getLoginUserId(req);
        List<OrderVO> orderList = orderService.getOrderVOListByUserId(userId);
        req.setAttribute("orderList",orderList);
        req.getRequestDispatcher("order_list.jsp").forward(req,resp);
    }
}
